class TakeoutStatus {
  //自取
  static const int SELF_PICK = 2;

  //外卖
  static const int TAKEOUT = 1;

  /*
    列表查询状态
   */
  //新订单
  static const int NEW_ORDER = 1;

  //待配送
  static const int TAKE_PICKUP = 2;

  //配送中
  static const int IN_DELIVERY = 3;

  //待提货
  static const int WAIT_PICKUP = 4;

  //已完成
  static const int COMPLETED = 5;

  //异常单
  static const int ABNORMA_ORDER = 6;

  //售后单
  static const int REBACK_ORDER = 7;

  //正常取消的订单
  static const int NORMAL_REJECT = 8;

  //长时间据单
  static const int LONG_TIME_REJECT = 9;

  //订单已关闭
  static const int CLOSE_ORDER = 10;

  //未支付取消的订单
  static const int NO_PAY_CLOSE_ORDER = 11;

  /*
    列表查询状态结束
   */

  /*
    外卖订单状态
   */
  //待支付
  static const int WAITING_PAY = 1;

  //商家待接单
  static const int WAITING_RECEIVE_ORDER = 2;

  //商家已接单
  static const int RECEIVE_ORDER = 3;

  //商家已拒单
  static const int REFUSE_ORDER = 4;

  //骑手正在赶往商家
  static const int RIDER_TO_STORE = 5;

  //骑手到店取货中
  static const int RIDER_GET_PACKAGE = 6;

  //骑手正在送货
  static const int RIDER_DELIVERING_PACKAGE = 7;

  //订单已完成
  static const int ORDER_COMPUTED = 8;

  //取消订单
  static const int ORDER_CANCEL = 9;



  /*
    外卖订单状态结束
   */

  /*
    自取外卖订单状态
   */

  //等待到店自取
  static const int WAITING_TO_PICK = 3;

  //订单明细
  static const int DETAIL_COMPLETED = 0;
  static const int DETAIL_ABNORMAL = 1;

  /*
    自取外卖订单状态结束
   */
  int type;
  int takeOutStatus;
  int systemOrderStatus;

  String get statusName {

////v1
//    if (systemOrderStatus == LONG_TIME_REJECT) {
//      return '骑手未接单';
//    }

//    if (systemOrderStatus == CLOSE_ORDER) {
//      return '已关闭';
//    }
//
//    if ([ABNORMA_ORDER,  NO_PAY_CLOSE_ORDER].contains(systemOrderStatus)) {
//      return '异常单';
//    }
//
//    if (systemOrderStatus == LONG_TIME_REJECT) {
//      return '已拒单';
//    }
//
//    if (systemOrderStatus == NORMAL_REJECT) {
//      return '已取消';
//    }
//
//    if (systemOrderStatus == REBACK_ORDER) {
//      return '待退款';
//    }
//
//    if (systemOrderStatus == NEW_ORDER) {
//      return '待接单';
//    }
//
//    if (systemOrderStatus == COMPLETED) {
//      return '已完成';
//    }
//
//    if (takeOutStatus == RECEIVE_ORDER) {
//      return type == SELF_PICK ? '待取餐' : '待接单';
//    }
//
//    if (takeOutStatus == RIDER_GET_PACKAGE) {
//      return '取货中';
//    }
//
//    if (takeOutStatus == RIDER_DELIVERING_PACKAGE) {
//      return '配送中';
//    }
//
//    if (takeOutStatus == ORDER_COMPUTED) {
//      return '已完成';
//    }
//
//    if (takeOutStatus == RIDER_TO_STORE) {
//      return '骑手赶往商家中';
//    }


//v2

    if (systemOrderStatus == NEW_ORDER) {
      return '待接单';
    }
    //待配送多种状态
    if (systemOrderStatus == TAKE_PICKUP) {
      if (takeOutStatus == WAITING_PAY) {
        return '待支付';
      }
      if (takeOutStatus == WAITING_RECEIVE_ORDER) {
        return '待骑手接单'; //待接单
      }
      if (takeOutStatus == RECEIVE_ORDER) {
        return '待骑手接单'; //商家已接单 前端显示 待接单 (收银机端 加小费按钮)
      }
      if (takeOutStatus == REFUSE_ORDER) {
        return '已关闭';
      }
      if (takeOutStatus == RIDER_TO_STORE) {
        return '骑手正在赶往商家';
      }

      if (takeOutStatus == RIDER_GET_PACKAGE) {
        return '骑手到店取货中';
      }
      if (takeOutStatus == RIDER_DELIVERING_PACKAGE) {
        return '骑手正在送货';
      }
      if (takeOutStatus == ORDER_COMPUTED) {
        return '订单完成';
      }
      if (takeOutStatus == ORDER_CANCEL) {
        return '取消订单';
      }

      return '';
    }
    if (systemOrderStatus == IN_DELIVERY) {
      return '骑手配送中';
    }
    if (systemOrderStatus == WAIT_PICKUP) {
      return '待提货';
    }
    if (systemOrderStatus == COMPLETED) {
      return '已完成';
    }
    if (systemOrderStatus == ABNORMA_ORDER) {
      return '顾客申请整单退款'; //异常单
    }
    if (systemOrderStatus == REBACK_ORDER) {
      return '顾客申请退款'; //售后单
    }

    //后端系统状态 前端不会显示
    if (systemOrderStatus == NORMAL_REJECT) {
      return '正常取消的订单';
    }
    if (systemOrderStatus == LONG_TIME_REJECT) {
      return '拒单';
    }
    if (systemOrderStatus == CLOSE_ORDER) {
      return '订单已关闭';
    }
    if (systemOrderStatus == NO_PAY_CLOSE_ORDER) {
      return '未支付取消的订单';
    }

     return '';
  }
}
